﻿<Window x:Class="BaMusaSoft.RPS.View.AddContractWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="إضافة عقد" Height="293" Width="480"
        FlowDirection="RightToLeft" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="ToolWindow"
        FontFamily="Simplified Arabic" FontSize="16" Loaded="WindowLoaded">
    <Grid x:Name="LayoutGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid x:Name="SearchGrid" Grid.Row="0" Margin="10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="رقم العقار"  />
            <TextBox Grid.Column="1" x:Name="txtCustomerName" VerticalAlignment="Center"
               Text="{Binding Path=PropertyNo, UpdateSourceTrigger=PropertyChanged}" Height="35" TabIndex="0"/>
            <Button Grid.Column="2" Content="{StaticResource FindImage}" Command="{Binding SearchCommand}" />
        </Grid>
        <Grid x:Name="ResultGrid" Grid.Row="1" Margin="10">
            <ListBox  Grid.Column="1" Grid.Row="1" TabIndex="1" ItemsSource="{Binding Contracts}"
               IsSynchronizedWithCurrentItem="True" SelectionChanged="ItemSelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding Property.Description}" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

        </Grid>
        <Grid x:Name="CommandsGrid" Grid.Row="2" Background="#FFF0F0F0" >
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left">
                <Button Content="{StaticResource RefreshImage}" ToolTip="تحديث" Command="{Binding RefreshCommand}" Margin="10,0,0,0" />
            </StackPanel>
            <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="{StaticResource OkImage}" TabIndex="3"  Click="OkButtonClick"
                IsDefault="True" />
                <Button Content="{StaticResource CancelImage}" HorizontalAlignment="Left" TabIndex="2" 
                        Click="CancelButtonClick" IsCancel="True" Margin="5,0,10,0" />

            </StackPanel>
        </Grid>
    </Grid>
</Window>